package cn.accp.war;

import java.util.Scanner;

import cn.accp.war.base.Weapon;
import cn.accp.war.impl.Plan;
import cn.accp.war.impl.Ship;
import cn.accp.war.impl.Tank;

public class Game {
	public static void play(Weapon weapon) {
		weapon.load();
		weapon.aim();
		weapon.fire();
	}

	public Weapon creat(int flag) {
		switch (flag) {
		case 1:
			return new Plan();
		case 2:
			return new Tank();
		case 3:
			return new Ship();
		default:
			return null;
		}

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int choice;
		do {
			System.out.println("请选武器类型：");
			System.out.println("1.战斗机");
			System.out.println("2.坦克");
			System.out.println("3.军舰");
			System.out.println("4.游戏退出");
			choice = input.nextInt();
		} while (choice < 1 || choice > 4);
		if (choice == 4) {
			System.out.println("游戏退出了，再见！");
		} else {

			Game game = new Game();
			Weapon weapon = game.creat(choice);
			play(weapon);
		}
	}

}
